<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

class News extends MX_Controller {

	public function __construct() {
		parent::__construct();
		
		$this->load->model('news_models');
		
		$this->template->set_partial('nav_bar','header/nav_bar');
		
	}
	
	function index()
	{
		$data['news']['all'] = $this->news_models->getNews(5);
		
		$this->load->view('news',$data);
	}
	
	function news_view()
	{
		$data['site_title'] = $this->settings_model->siteInfo('web_title');
		$news_id = $this->commoncall->get_id(current_url());
		
		$data['news']['info'] = $this->news_models->get_news_info($news_id);
		$this->template->set_layout('details_layout');
		$this->template->set_partial('header_search', 'header/header_search');
		
		$this->template->set_breadcrumb('Home', '/')
		->set_breadcrumb('News', '');
		
		$this->template->build('news_view',$data);
		
	}
	
	/*IMPORTANT NOTE.....
	 * 
	 * 
	 * 
	function show($para='CATEGORY', $pID=0, $per_page=5, $offset=0){
	
		$data['Page'] ='LISTING';
		$sql='';
		if($para == 'CATEGORY'){
	
			$id = $this->commoncall->get_id(current_url());
				
				
				
			$seg_cat = $this->uri->segment(3);
				
			$key_id = $this->commoncall->get_id($seg_cat);
				
			$offset = 0 + $this->uri->segment(4);
				
			$total = $this->listing_model->count_all_listing($key_id);
				
			//print $total;
			//die();
				
			$perpage = 5;
			$config['per_page'] = $perpage;
			$config['total_rows'] = $total;
			$config['uri_segment'] = '4';
				
			$config['base_url'] = base_url() . 'browse/practice/'.$seg_cat;
				
				
				
			$cur =base_url()."browse/practice/'.$seg_cat";
			$cur = '<a href="'. $cur   .'">&laquo; First</a>';
			$config['full_tag_open'] = '<ul class="pagination">';
			$config['full_tag_close'] = '</ul><!--pagination-->';
			$config['first_link'] = '&laquo; First';
			$config['first_tag_open'] = '<li class="prev page" style="display:inline">';
			$config['first_tag_close'] = '</li>';
			$config['last_link'] = 'Last &raquo;';
			$config['last_tag_open'] = '<li class="next page" style="display:inline">';
			$config['last_tag_close'] = '</li>';
			$config['next_link'] = 'Next &rarr;';
			$config['next_tag_open'] = '<li class="next page" style="display:inline">';
			$config['next_tag_close'] = '</li>';
			$config['prev_link'] = '&larr; Previous';
			$config['prev_tag_open'] = '<li class="prev page" style="display:inline">';
			$config['prev_tag_close'] = '</li>';
			$config['cur_tag_open'] = '<li class="active"><a href="">';
			$config['cur_tag_close'] = '</a></li>';
			$config['num_tag_open'] = '<li class="page">';
			$config['num_tag_close'] = '</li>';
			$config['display_pages'] = FALSE;
				
			$this->pagination->initialize($config);
				
			$cityID = 0;
	
			if($this->input->cookie('cook_city')){
				$cityID = $this->input->cookie('cook_city');
			}
	
	
			if($cityID !=0){
				$sql = "SELECT t1.* FROM post AS t1
				LEFT JOIN term AS t2 ON t1.id = t2.listing_id
				WHERE t1.status =  51  and t1.city = $cityID and t2.term_value = $pID LIMIT $offset, $limit" ;
			}else{
				$sql = "SELECT DISTINCT t1.title, t1.* FROM post AS t1
				INNER JOIN term AS t2 ON t1.id = t2.listing_id
				WHERE t2.term =  'key'
				AND t2.term_value =  $pID LIMIT $offset, $per_page" ;
			}
	
				
				
		}
		if($para == 'REGION'){
			$sql = "SELECT DISTINCT t1.title,t1.* FROM post AS t1
			INNER JOIN term AS t2 ON t1.id = t2.listing_id
			WHERE t1.state = $pID LIMIT $offset, $limit" ;
		}
	
		if($para == 'CITY'){
			$sql = "SELECT DISTINCT t1.title,t1.* FROM post AS t1
			INNER JOIN term AS t2 ON t1.id = t2.listing_id
			WHERE t1.city = $pID LIMIT $offset, $limit" ;
		}
		//print $sql;
		//-- GET LISTING FROM TERM --//
		$data['listing'] = $result = $this->db->query($sql)->result();;
	
	
	
		$this->load->view('listing',$data);
	
	}
*/	
	
	
}